'use strict';
/**
 * qq strategy
 * https://github.com/qdsang/passport-qq
 */

var passport = require('passport'),
    qqStrategy = require('passport-qq').Strategy,
    config = require('../config');
    //users = require('../../app/controllers/users.server.controller');

module.exports = function() {
    passport.use(new qqStrategy({
            clientID: config.strategies.qq.clientId,
            clientSecret: config.strategies.qq.clientSecret,
            callbackURL:  config.strategies.qq.callbackUrl //"http://127.0.0.1:3000/auth/qq/callback"
        },
        function(accessToken, refreshToken, profile, done) {

            User.findOrCreate({ qqId: profile.id }, function (err, user) {
                return done(err, user);
            });
        }
    ));
};
